<div class="main-content">
	<!-- #section:basics/content.breadcrumbs -->
	<div class="breadcrumbs" id="breadcrumbs">
		<script type="text/javascript">
			try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
		</script>

		<ul class="breadcrumb"><li>
			<i class="ace-icon fa fa-th-large th-large-icon"></i> 系统管理 <i class="ace-icon fa fa-angle-double-right"></i> 房态管理 
		</li></ul><!-- /.breadcrumb -->
	</div>

	<!-- /section:basics/content.breadcrumbs -->
	<div class="page-content">
		<!-- #section:settings.box -->
		<div class="ace-settings-container" id="ace-settings-container" style="margin-top:-48px;">
			<div class="btn btn-app btn-xs btn-warning ace-settings-btn" id="ace-settings-btn">
				<i class="ace-icon fa fa-cog bigger-150"></i>
			</div>
			<div class="ace-settings-box clearfix" id="ace-settings-box">
				<div class="pull-left width-50">
					<!-- #section:settings.skins -->
					<div class="ace-settings-item">
						<div class="pull-left">
							<select id="skin-colorpicker" class="hide">
								<option data-skin="no-skin" value="#438EB9" <?=!isset($_COOKIE['ace_skin'])||$_COOKIE['ace_skin']!='no-skin'?'selected':''?> >#438EB9</option>
								<option data-skin="skin-1" value="#222A2D" <?=isset($_COOKIE['ace_skin'])&&$_COOKIE['ace_skin']=='skin-1'?'selected':''?> >#222A2D</option>
								<option data-skin="skin-2" value="#C6487E" <?=isset($_COOKIE['ace_skin'])&&$_COOKIE['ace_skin']=='skin-2'?'selected':''?> >#C6487E</option>
								<option data-skin="skin-3" value="#D0D0D0" <?=isset($_COOKIE['ace_skin'])&&$_COOKIE['ace_skin']=='skin-3'?'selected':''?> >#D0D0D0</option>
							</select>
						</div>
						<span>&nbsp;肤色切换</span>
					</div>

					<!-- /section:settings.skins -->

					<!-- #section:settings.navbar -->
					<div class="ace-settings-item">
						<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-navbar" />
						<label class="lbl" for="ace-settings-navbar">&nbsp; 固定导航</label>
					</div>

					<!-- /section:settings.navbar -->

					<!-- #section:settings.sidebar -->
					<div class="ace-settings-item">
						<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-sidebar" />
						<label class="lbl" for="ace-settings-sidebar">&nbsp; 固定菜单栏</label>
					</div>
					<!-- /section:settings.sidebar -->
					
					<!-- #section:settings.container -->
					<div class="ace-settings-item">
						<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-add-container" />
						<label class="lbl" for="ace-settings-add-container">&nbsp; 宽窄屏切换</label>
					</div>
					<!-- /section:settings.container -->
				</div><!-- /.pull-left -->

				<div class="pull-left width-50">
					<!-- #section:basics/sidebar.options -->
					<div class="ace-settings-item">
						<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-hover" />
						<label class="lbl" for="ace-settings-hover">&nbsp; 内级栏目切换</label>
					</div>

					<div class="ace-settings-item">
						<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-compact" />
						<label class="lbl" for="ace-settings-compact">&nbsp; 菜单栏切换</label>
					</div>

					<div class="ace-settings-item">
						<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-highlight" />
						<label class="lbl" for="ace-settings-highlight">&nbsp; 当前菜单凸显</label>
					</div>
					<!-- /section:basics/sidebar.options -->
				</div><!-- /.pull-left -->
			</div><!-- /.ace-settings-box -->
		</div><!-- /.ace-settings-container -->

		<!-- /section:settings.box -->
		<div class="page-content-area">
			<div class="row">
				<div class="col-xs-12 col-sm-12" style="margin-top:10px;">
					<button class="btn btn-yellow btn-sm" data-rel="tooltip" title="推送房态房价" onclick="pstps()">推送房态房价</button>
					<button class="btn btn-sm" data-rel="tooltip" title="当天满房推送" onclick="tdstus(this,1)">当天满房推送</button>
					<button class="btn btn-sm" data-rel="tooltip" title="当天满房推送" onclick="tdstus(this,2)">明天满房推送</button>
				</div>
				<!--<div id="getTypeSo">
					<div class="col-xs-12 col-sm-4 col-lg-3" style="margin-top:10px;">
						<input type="text" name="keyword" placeholder="关键字搜索酒店" data-rel="tooltip" title="关键字搜索酒店">
						<button type="button" class="btn btn-sm pull-left btn-default" onclick="search(1)">搜索</button>
					</div>
					<div class="col-xs-12 col-sm-4 col-md-3 col-lg-2" style="margin-top:10px;">
						<select class="form-control" name="hotel" placeholder="酒店选择" data-rel="tooltip" title="酒店选择" style="max-width:210px;" onchange="checkHotel(1)">
							<option value="0">请选择酒店</option>
						</select>
					</div>
					<div class="col-xs-12 col-sm-4 col-md-3 col-lg-2" style="margin-top:10px;">
						<select class="form-control" name="htype" placeholder="房型选择" data-rel="tooltip" title="房型选择" style="max-width:210px;">
							<option value="0">请选择房型</option>
						</select>
					</div>
					<div class="col-xs-12 col-sm-4 col-md-3 col-lg-2" style="margin-top:10px;">
						<button type="reset" class="btn btn-sm btn-default">重置</button>
						<button type="button" class="btn btn-sm btn-primary">更新</button>
					</div>
					<div class="col-xs-12 col-sm-4 col-md-3 col-lg-2" style="margin-top:10px;">
						<label class="sethtml red"></label>
					</div>
				</div>-->
				<div class="col-xs-12">
					<div class="col-xs-12 col-sm-12" style="margin-bottom:10px;margin-top:5px;/*border-top:2px #999999 solid;*/">
						<form class="form-horizontal" role="form" action="" method="get" style="margin-left:-24px;">
							<div class="col-xs-6 col-sm-4 col-lg-2" style="margin-top:10px;">
								<input type="text" name="hotelName" value="<?=$hotelName?>" placeholder="酒店名称" data-rel="tooltip" title="酒店名称">
							</div>
							<div class="col-xs-6 col-sm-4 col-lg-2" style="margin-top:10px;">
								<input type="text" name="hotelCode" value="<?=$hotelCode?>" placeholder="酒店编号" data-rel="tooltip" title="酒店编号">
							</div>
							<div class="col-xs-6 col-sm-4 col-lg-2" style="margin-top:10px;">
								<input type="text" name="typeName" value="<?=$typeName?>" placeholder="房型名称" data-rel="tooltip" title="房型名称">
							</div>
							<div class="col-xs-6 col-sm-4 col-lg-2" style="margin-top:10px;">
								<input type="text" name="typeCode" value="<?=$typeCode?>" placeholder="房型编号" data-rel="tooltip" title="房型编号">
							</div>
							<div class="col-xs-12 col-md-3 col-sm-5 col-lg-2" style="margin-top:10px;">
								<div class="input-daterange input-group">
									<input type="text" class="input-md form-control" name="start" value="<?=$start?>" placeholder="开始时间" data-rel="tooltip" title="开始时间"/>
									<span class="input-group-addon"><i class="fa fa-exchange"></i></span>
									<input type="text" class="input-md form-control" name="end" value="<?=$end?>" placeholder="结束时间" data-rel="tooltip" title="结束时间"/>
								</div>
							</div>
							<div class="col-xs-12 col-sm-2 col-lg-2" style="margin-top:10px;">
								<button class="btn btn-info btn-sm" data-rel="tooltip" title="搜索"><i class="ace-icon fa fa-search"></i>search</button>
							</div>
						</form>
					</div>
					<div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th>酒店名称</th>
                                    <th>酒店编号</th>
                                    <th>房型名称</th>
                                    <th>房型编号</th>
                                    <th>日期</th>
                                    <th>房价</th>
                                    <th>早餐</th>
                                    <th>人数/间数</th>
                                    <th>状态</th>
                                    <th>更新时间</th>
                                </tr>
                            </thead>

                            <tbody>
                                <?
                                if($re){
                                foreach($re as $k=>$v){?>
                                <tr>
                                    <td><?= $v['hName'] ?></td>
                                    <td><?= $v['hid'] ?></td>
                                    <td><?= $v['tName'] ?></td>
                                    <td><?= $v['rid'] ?></td>
                                    <td><?= $v['date'] ?></td>
                                    <td><?= $v['price'] ?></td>
                                    <td><?= $v['breakfast'] ?></td>
                                    <td><?= $v['maxNum'] ?></td>
                                    <td><?= $v['roomStatus']==1?'<font class="badge badge-success">正常</font>':'<font class="badge badge-danger">满房</font>'?></td>
									<td><?= $v['created'] ?></td>
								</tr>
                                <?}
                                }
                                ?>
                            </tbody>
                        </table>
                    </div>
                    <?= $pageHtml ?>
				</div>
			</div>
		</div><!-- /.page-content-area -->
	</div><!-- /.page-content -->
</div><!-- /.main-content -->
<!-- inline scripts related to this page -->

<link rel="stylesheet" href="/public/assets/css/datepicker.css" />
<script src="/public/assets/js/date-time/bootstrap-datepicker.min.js"></script>
<script src="/public/assets/js/date-time/daterangepicker.min.js"></script>
<script src="/public/assets/js/date-time/moment.min.js"></script>
<script src="/public/assets/js/date-time/locales/bootstrap-datepicker.zh-CN.js"></script>
<div class="bootbox modal fade bootbox-prompt in" tabindex="-1" role="dialog" aria-hidden="false" id="accountForm" style="position:absolute;display:block;left:100%;">
	<div style="background-color: #303030;filter:alpha(opacity=70);-moz-opacity:0.7;-khtml-opacity: 0.7;opacity: 0.7;position: fixed;width: 100%;height: 100%;"></div>
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="bootbox-close-button close" data-dismiss="modal" aria-hidden="true" onclick="animateColse('#accountForm')">×</button>
				<h4 class="modal-title">推送房态房价（不选择默认全部）</h4>
			</div>
			<form class="bootbox-form" id="potTal">
				<div class="modal-body">
					<div class="bootbox-body">
						<div class="col-xs-12 col-sm-5" style="padding:0;margin-bottom:10px;">
							<input type="text" name="keyhotel" placeholder="关键字搜索酒店" data-rel="tooltip" title="关键字搜索酒店">
							<button type="button" class="btn btn-sm pull-left btn-default" onclick="search(2)">搜索</button>
						</div>
						<div class="col-xs-12 col-sm-5" style="padding:0;margin-bottom:10px;">
							<select class="form-control" name="Thotel" placeholder="酒店选择" data-rel="tooltip" title="酒店选择" style="max-width:210px;" onchange="checkHotel(2)">
								<option value="0">请选择酒店</option>
							</select>
						</div>
						<div class="col-xs-12 col-sm-5" style="padding:0;margin-bottom:10px;">
							<select class="form-control" name="Thtype" placeholder="房型选择" data-rel="tooltip" title="房型选择" style="max-width:210px;">
								<option value="0">请选择房型</option>
							</select>
						</div>
						<div class="col-xs-12 col-sm-5" style="padding:0;margin-bottom:10px;">
							<select class="form-control" name="Tchannels" placeholder="请选择渠道" data-rel="tooltip" title="请选择渠道" style="max-width:210px;">
								<option value="0">请选择渠道</option>
								<?
								foreach($channels as $k=>$v){
									?><option value="<?=$v['osiiid']?>"><?=$v['title']?></option><?
								}
								?>
							</select>
						</div>
						<div class="col-xs-12 col-sm-5" style="padding:0;margin-bottom:10px;">
							<div class="input-daterange input-group">
								<input type="text" class="input-md form-control" name="start" placeholder="开始时间" data-rel="tooltip" title="开始时间"/>
								<span class="input-group-addon"><i class="fa fa-exchange"></i></span>
								<input type="text" class="input-md form-control" name="end" placeholder="结束时间" data-rel="tooltip" title="结束时间"/>
							</div>
						</div>
					</div>
					<div style="clear:both;"></div>
				</div>
				<div class="modal-footer">
					<label class="pull-left red" id="poshtml"></label>
					<button type="button" class="btn btn-primary btn-sm" onclick="potTal(this,1)">推送房态</button>
					<button type="button" class="btn btn-yellow btn-sm" onclick="potTal(this,2)">推送房价</button>
				</div>
			</form>
		</div>
	</div>
</div>

<script type="text/javascript">
$('.input-daterange').datepicker({
	autoclose:true,
	format:'yyyy-mm-dd',
	language:"zh-CN",
	todayBtn:false,
	todayHighlight:false,
	startDate:'+0d'
});
function pstps(){$("#accountForm").animate({left:"0%"});}
function search(key){
	var data='';
	if(key==1){data='keyword='+$('input[name="keyword"]').val();}else{data='keyword='+$('input[name="keyhotel"]').val();}
	$.ajax({
        type:'post',
        url:"<?=$this->url('system/serachHotel')?>",
        data:data,
        dataType:'json',
        success:function (r){
            if(r.state==1){
				if(key==1){$('select[name="hotel"]').html(r.html);}
				else{$('select[name="Thotel"]').html(r.html);}
				gritter("gritter-success gritter-light",10000,"操作提示","搜索成功，请选择酒店！");
            }else if(r.state==0){
                gritter("gritter-error gritter-light",10000,"操作提示",r.html);
            }
        },error:function(){
            gritter("gritter-error gritter-light",10000,"操作提示","网络错误！请联系我方工作人员。");
        }
    });
}
function checkHotel(key){
	var data='';
	if(key==1){data='hid='+$('select[name="hotel"]').val();}else{data='hid='+$('select[name="Thotel"]').val();}
	$.ajax({
        type:'post',
        url:"<?=$this->url('system/serachRoom')?>",
        data:data,
        dataType:'json',
        success:function (r){
            if(r.state==1){
				if(key==1){$('select[name="htype"]').html(r.html);}
				else{$('select[name="Thtype"]').html(r.html);}
				gritter("gritter-success gritter-light",10000,"操作提示","搜索成功，请选择房型！");
            }else if(r.state==0){
                gritter("gritter-error gritter-light",10000,"操作提示",r.html);
            }
        },error:function(){
            gritter("gritter-error gritter-light",10000,"操作提示","网络错误！请联系我方工作人员。");
        }
    });
}
$("#getTypeSo button.btn-primary").click(function(){
	if(confirm("更新时间较长，确认更新后，请勿刷新跳转到其它页面！")){
		$(this).html("更新中...").prop("disabled",true);
		$("#getTypeSo label.sethtml").empty();
		$.ajax({
			type:'post',
			url:"<?=$this->url('hotelapi/getHotelRoomBatch@api')?>",
			data:"hid="+$('select[name="hotel"]').val()+"&rid="+$('select[name="htype"]').val(),
			dataType:'json',
			success:function (r){
				if(r.state==1){
					gritter("gritter-success gritter-light",10000,"操作提示",r.html);$("#getTypeSo label.sethtml").html(r.html);
				}else if(r.state==0){
					gritter("gritter-error gritter-light",10000,"操作提示",r.html);$("#getTypeSo label.sethtml").html(r.html);
				}
				$("#getTypeSo button.btn-primary").html("更新").prop("disabled",false);
			},error:function(){
			   gritter("gritter-error gritter-light",10000,"操作提示","网络错误！请联系我方工作人员。");
			   $("#getTypeSo label.sethtml").html("网络错误！请联系我方工作人员。");
			   $("#getTypeSo button.btn-primary").html("更新").prop("disabled",false);
			}
		});
	}
})
function potTal(obj,typ){
	var url='';
	if(typ==1){url="<?=$this->url('newxHotel/roomstatus@api')?>";}else{url="<?=$this->url('newxHotel/typePrice@api')?>";}
	if(confirm("推送时间较长，确认推送后，请勿刷新跳转到其它页面！")){
		$(obj).html("推送中....").prop("disabled",true);
		$("#poshtml").empty();
		$.ajax({
			type:'post',
			url:url,
			data:$('#potTal').serialize(),
			dataType:'json',
			success:function (r){
				if(r.state==1){
					gritter("gritter-success gritter-light",10000,"操作提示",r.html);$("#poshtml").html(r.html);
				}else if(r.state==0){
					gritter("gritter-error gritter-light",10000,"操作提示",r.html);$("#poshtml").html(r.html);
				}
				if(typ==1){$(obj).html("推送房态").prop("disabled",false);}else{$(obj).html("推送房价").prop("disabled",false);}
			},error:function(){
			   gritter("gritter-error gritter-light",10000,"操作提示","网络错误！请联系我方工作人员。");
			   $("#poshtml").html("网络错误！请联系我方工作人员。");
			   if(typ==1){$(obj).html("推送房态").prop("disabled",false);}else{$(obj).html("推送房价").prop("disabled",false);}
			}
		});
	}
}
function tdstus(obj,type){
	if(confirm("推送时间较长，确认推送后，请勿刷新跳转到其它页面！")){
		$(obj).html("推送中....").prop("disabled",true);
		$.ajax({
			type:'post',
			url:"<?=$this->url('newxHotel/tdroomstaus@api')?>",
			data:'type='+type,
			dataType:'json',
			success:function (r){
				if(r.state==1){
					gritter("gritter-success gritter-light",10000,"操作提示",r.html);$("#poshtml").html(r.html);
				}else if(r.state==0){
					gritter("gritter-error gritter-light",10000,"操作提示",r.html);$("#poshtml").html(r.html);
				}
				$(obj).html("当天满房推送").prop("disabled",false);
			},error:function(){
			   gritter("gritter-error gritter-light",10000,"操作提示","网络错误！请联系我方工作人员。");
			   $("#poshtml").html("网络错误！请联系我方工作人员。");
			   $(obj).html("当天满房推送").prop("disabled",false);
			}
		});
	}
}
</script>